<?php if($cat_id==35):?>
<?php include SITETPL ."print_search.phtml"; ?>
<?php endif;?>
	<h2>Products</h2>	
	<div class="productlist">
		<?php
			if(count($item_arr) > 0)
			{
		?>
		<div class="mblock clearfix listinfo">
			<div class="pagination lblock">
		<?php
		
			if ($pagenum == 1) 
			{
			
			} else {	
				echo " ";		
				$previous = $pagenum-1;		
				echo " <a href='?$module/$param1/$param2/pagenum/$previous' class='prv'>Previous</a>";		
			}
			
			if($last > 1)
			{
			
				for ($rows = 1; $rows <= $last; $rows++)
				{
					if ($rows == $pagenum) {
						echo "<a href='#' class='active'>" . $rows . "</a>";
					} else {
						echo "<a href='?$module/$param1/$param2/pagenum/$rows'>$rows</a>";
					}
				}
			}
			
			
			if ($pagenum == $last) {
				
			} else {	
				$next = $pagenum+1;		
				echo " <a href='?$module/$param1/$param2/pagenum/$next' class='nxt'>Next</a>";		
				echo " ";		
				//echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";		
			}
		?>
			</div>
		</div>
		<div class="products">
			<?php //print_r($item_arr);
				foreach ($item_arr as $item_entry) :
					$filePath= DOCROOT."images/products/thumbs/". $item_entry['filename'];
                                        $imagePath= SITEURL."images/products/thumbs/". $item_entry['filename'];
			?>
			<form name="frmProductDetails" method="POST" action="<?php echo SITEURL; ?>index.php/?addtocart">
			<div class="product">
				<div class="mblock clearfix inner">
					<div class="lblock pimage">
					<?php
						if(file_exists($filePath))
                     	{
                    ?>
						<img src="<?php echo $imagePath; ?>" border="0" alt="<?php echo $item_entry['product_title']; ?>" />
					<?php 
                     	} else {
                    ?>
                    	 <img src="<?php echo SITEURL; ?>images/products/thumbs/NoImage.jpg" border="0" alt="<?php echo $item_entry['product_title']; ?>" width="100" height="100" />
                    <?php
                     	}
                     ?>
					</div>
					<div class="rblock actions">
						<a href="<?php echo SITEURL; ?>index.php/?details/<?php echo $item_entry['productid']; ?>" class="details">Details</a>
						<div class="quadd">
							<label>Quantity :</label><input type="text" name="txtQty" id="txtQty" value="1" maxlength="5" size="2" onkeyup="validateQty('<?php echo $item_entry['productid']; ?>')" class="qinp" />
							<input type="submit" name="btnAddCart" value="Add to Basket" class="add" />
							<input type="hidden" name="productid" id="productid" value="<?php echo $item_entry['productid']; ?>" />
    <input type="hidden" name="price" id="price" value="<?php echo $item_entry['product_price_lkr']; ?>" />
						</div>
					</div>
					<div class="rblock prices">
						Only : 
						<div class="formatedPrice">
                          <?php 
								if(!empty($item_entry['discount']))
								{
							?>
								<s>LKR <?php echo number_format($item_entry['product_price_lkr'], 2, '.', ','); ?></s> LKR <?php echo number_format($item_entry['discount'], 2, '.', ','); ?>
							<?php 	
								} else {
									echo "LKR " . number_format($item_entry['product_price_lkr'], 2, '.', ','); 
								}
							?>

                        </div>
					</div>
					<div class="cblock desc">
						<div class="title"><a href="<?php echo SITEURL; ?>index.php/?details/<?php echo $item_entry['productid']; ?>"><?php echo $item_entry['product_title']; ?></a></div>
						<div class="webid">Item Number : <?php echo $item_entry['item_code']; ?></div>
						<div class="shortdesc"><?php echo $item_entry['product_dsc_en']; ?></div>
					</div>
				</div>
			</div>
			</form>
			<?php 
				endforeach;
			?>
		</div>
		
		
		<div class="mblock clearfix listinfo">
			<div class="pagination lblock">
		<?php
			if ($pagenum == 1) 
			{
			
			} else {	
				echo " ";		
				$previous = $pagenum-1;		
				echo " <a href='?$module/$param1/$param2/pagenum/$previous' class='prv'>Previous</a>";		
			}
			
			if($last > 1)
			{
			
				for ($rows = 1; $rows <= $last; $rows++)
				{
					if ($rows == $pagenum) {
						echo "<a href='#' class='active'>" . $rows . "</a>";
					} else {
						echo "<a href='?$module/$param1/$param2/pagenum/$rows'>$rows</a>";
					}
				}
			}
			
			if ($pagenum == $last) {
				
			} else {	
				$next = $pagenum+1;		
				echo " <a href='?$module/$param1/$param2/pagenum/$next' class='nxt'>Next</a>";		
				echo " ";		
				//echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";		
			}
		?>
			</div>
		</div>
		<?php
			} else {
				echo "Sorry. No items found under this category";
			}
		?>
	</div>